package com.ssy.lingxi.purchase.entity.tender;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 投标物料表
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/3/1
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "purchase_submit_tender")
public class SubmitTender implements Serializable {
    private static final long serialVersionUID = -6321885150693380880L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="submit_tender_seq")
    @SequenceGenerator(sequenceName="purchase_submit_tender_seq", name="submit_tender_seq",allocationSize = 1)
    private Long id;

    /**
     * 投标物料
     */
    @JsonManagedReference
    @OneToMany(mappedBy = "submitTender", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    private List<SubmitTenderMateriel> submitTenderMateriel;

    /**
     * 投标摘要
     */
    @Column(columnDefinition = "varchar(200)")
    private String remark;

    /**
     * 附件
     */
    @JsonManagedReference
    @OneToMany(mappedBy = "submitTender", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    private List<SubmitTenderFile> file;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long createTime = System.currentTimeMillis();
}
